package org.java.web;

import com.alibaba.fastjson.JSON;
import org.java.dao.DaoImpl.ArtArtistDao;
import org.java.entity.Artist;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

@WebServlet( "/artist")
public class ArtistServlet extends BaseServlet {

    //传递Artist中的参数，实现多重选取功能
    private ArtArtistDao artArtistDao = new ArtArtistDao();

    protected void art(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        String name=request.getParameter("name");
//        System.out.println(name);
        List<Artist> list = artArtistDao.getList();
        System.out.println(list.get(0).getA_headp());
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        String json = JSON.toJSONString(list);
        out.write(json);
        out.flush();
        out.close();

    }}
